---客户端开发辅助接口
--@module
local _svr = class("App", require("framework.cls.baseserver"))
--===================================
--default params
local d = Ding
local Logger = d.Logger
--===================================

function _svr:ctor()
    local is_dev = d["RELEASE_CONF"].is_dev
    _svr.super:ctor()
    Logger:info("\n%s server is runing...", self:name())

    self:init_router()
end

function _svr:init_router()
    local orm_ccpm = d.Orm:get("ccpm")
    local orm_ccpmfav = d.Orm:get("ccpmfav")
    local ccpmapi = require("api.handler.ccpm").new(self, orm_ccpm, orm_ccpmfav)
    self:post(
        "/bin_chk",
        function()
            ccpmapi:post_binchk()
        end,
        "/add_plugin",
        function()
            ccpmapi:post_addplugin()
        end,
        "/dele_plugin",
        function()
            ccpmapi:post_deleplugin()
        end,
        "/add_tool",
        function()
            ccpmapi:post_addtool()
        end,
        "/test_add_fav", 
        function()
            ccpmapi:post_addplugin_fav()
        end
    )
    self:get(
        "/plugin_chk",
        function()
            ccpmapi:get_chkplugin_exist()
        end,
        "/tool_chk",
        function()
            ccpmapi:get_chktool_exist()
        end,
        "/get_pageinfo",
        function()
            ccpmapi:get_pageidxinfo()
        end,
        "/get_pageinfo_by_ptype",
        function()
            ccpmapi:get_pageinfo_by_ptype()
        end,
        "/get_plugininfo",
        function()
            ccpmapi:get_plugininfo()
        end
    )
end

return _svr
